package com.liaogui.web.template;

import com.liaogui.order.api.domain.ActInfo;
import com.liaogui.web.strategy.WeightRandomStrategy;
import com.liaogui.web.verify.VerifyStart;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.scripting.support.ResourceScriptSource;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * 大转盘抽奖
 * @author liaogui
 * @date 2025/2/27 22:43
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class BigTurntablePrizeDrawImpl extends PrizeDrawServiceTemplate {

    private final VerifyStart verifyStart;

    private final WeightRandomStrategy weightRandomStrategy;



    @Override
    public void beforePrizeDraw(ActInfo actInfo) {
        verifyStart.handler(actInfo);
    }

    @Override
    public void doPrizeDraw(ActInfo actInfo) {
        // 中奖
        actInfo.setPrizeInfo(weightRandomStrategy.drawPrize(actInfo.getPrizeInfos()));

    }

    @Override
    public void afterPrizeDraw(ActInfo actInfo) {
        // 记录活动抽奖次数




    }
}
